<?php

/**
 * RacksController
 * 
 * @package Sgit 
 * @author Juan Manuel Martinez Carrillo
 * @copyright Juan Manuel Martinez Carrillo
 * @version 2012
 * @access public
 * @revision 17/02/2012 9:06:
 * 
 */


class RacksActivosController extends Sgit_Controller_Action
{

    protected $_main_model = 'RacksActivos';
    protected $_main_form = 'RacksActivos';
    protected $_checkZona = true;


    public function indexAction()
    {

        $id_rack = $this->_request->getParam('id_rack');

        if (!$id_rack)
        {
            throw new Zend_Controller_Exception(sprintf('ID Rack is requireds for %s', $this->_controllerName . ':' . $this->_actionName));
        } 
        
        
        $this->_loadModel('Racks');
        $this->view->rack= $this->_model->Racks->getRack($id_rack);
        
           
        

     }

    /*
    public function pdfAction()
    {
    $this->_helper->layout->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);

    $pdf = new Sgit_Pdf('L');
    $pdf->setColumnas($this->_getXml());
    $pdf->SetTitle('Proyectos DC');
    $pdf->render($this->_rows(), $this->_controllerName);
    }

    public function excelAction()
    {
    $this->_helper->layout->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);

    $excel = new Sgit_Excel();
    $excel->setColumnas($this->_getXml());
    $excel->render($this->_rows(), $this->_controllerName);
    }
    */
    public function insertarAction()
    {
        $this->_reload();
        $this->_insertar();
    }

    public function editarAction()
    {
        $this->_reload();
        $this->_editar();
    }

    public function borrarAction()
    {
        $this->_borrar();
    }

    protected function _prepareValuesToDb()
    {
        $row = $this->_form->getValues();

        $id_rack = $this->_getParam('id_rack');
        if ($id_rack)
        {
            $row['id_rack'] = $id_rack;
        }


        return $row;
    }


    protected function _getFila($id)
    {
        $row = $this->_model->default->GetActivo($id);
        return $row;
    }


}
